import { getOrderFinishTemplateSelect } from '@/api/basic'
import { ref } from 'vue'

// 加载
const loading = ref(false)

// 结单模版下拉选项
const options = ref<Array<{ id: string; name: string; select: boolean }>>([])

/**
 * 获取结单模版下拉选项方法
 * @param {string} query - 搜素关键字
 */
const getOptionsFn = async (query: string) => {
  loading.value = true
  const data = {
    name: query,
    limit: 0,
    page: 0,
  }
  const res = await getOrderFinishTemplateSelect(data)
  options.value = res.data.data.rows
  loading.value = false
}

export default {
  loading,
  options,
  getOptionsFn,
}
